package com.ruoyi.teacher.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teacher.domain.TEvaluate;
import com.ruoyi.teacher.service.ITEvaluateService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 教学评价信息集Controller
 * 
 * @author Mie
 * @date 2022-04-18
 */
@RestController
@RequestMapping("/teacher/evaluate")
public class TEvaluateController extends BaseController
{
    @Autowired
    private ITEvaluateService tEvaluateService;

    /**
     * 查询教学评价信息集列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:evaluate:list')")
    @GetMapping("/list")
    public TableDataInfo list(TEvaluate tEvaluate)
    {
        startPage();
        List<TEvaluate> list = tEvaluateService.selectTEvaluateList(tEvaluate);
        return getDataTable(list);
    }

    /**
     * 导出教学评价信息集列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:evaluate:export')")
    @Log(title = "教学评价信息集", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TEvaluate tEvaluate)
    {
        List<TEvaluate> list = tEvaluateService.selectTEvaluateList(tEvaluate);
        ExcelUtil<TEvaluate> util = new ExcelUtil<TEvaluate>(TEvaluate.class);
        return util.exportExcel(list, "evaluate");
    }

    /**
     * 获取教学评价信息集详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:evaluate:query')")
    @GetMapping(value = "/{recordid}")
    public AjaxResult getInfo(@PathVariable("recordid") Long recordid)
    {
        return AjaxResult.success(tEvaluateService.selectTEvaluateById(recordid));
    }

    /**
     * 新增教学评价信息集
     */
    @PreAuthorize("@ss.hasPermi('teacher:evaluate:add')")
    @Log(title = "教学评价信息集", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TEvaluate tEvaluate)
    {
        return toAjax(tEvaluateService.insertTEvaluate(tEvaluate));
    }

    /**
     * 修改教学评价信息集
     */
    @PreAuthorize("@ss.hasPermi('teacher:evaluate:edit')")
    @Log(title = "教学评价信息集", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TEvaluate tEvaluate)
    {
        return toAjax(tEvaluateService.updateTEvaluate(tEvaluate));
    }

    /**
     * 删除教学评价信息集
     */
    @PreAuthorize("@ss.hasPermi('teacher:evaluate:remove')")
    @Log(title = "教学评价信息集", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recordids}")
    public AjaxResult remove(@PathVariable Long[] recordids)
    {
        return toAjax(tEvaluateService.deleteTEvaluateByIds(recordids));
    }
}
